how to Remove the last Character from a String in JavaScript